﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace WpfApp6.Converter
{
    public class MultiValueConverter : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            string result = "无";
            if (int.TryParse(values[0].ToString(), out int age)&&decimal.TryParse(values[1].ToString(),out decimal money))
            {
                if (age <= 20 && money >= 50000 && money <= 100000)
                    result = "年轻有为";
                else if (age > 20 && age <= 30 && money >= 1000 && money <= 10000)
                    result = "碌碌无为";
                else if (age > 30 && age <= 40 && money >= 10000 && money <= 60000)
                    result = "普通家庭";
                else if (age > 40 && age <= 50 && money >= 100000 && money <= 1000000)
                    result = "小康家庭";
                else if (age > 40 && age <= 50 && money >= 500000 && money <= 9000000)
                    result = "富豪";
                else
                    result = "未知";
            }
            return result;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
